<!DOCTYPE html>
<html lang="en">

<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <meta http-equiv="X-UA-Compatible" content="ie=edge">
    <title>Document</title>
    <script>
        /* 
            values():遍历数组
         */

        const array1 = ['aa', 'bb', 'cc','dd'];
        const iterator = array1.values();

        let item = iterator.next()
        console.log(item)     //这是一个对象
        console.log(item.value)//对象的第一个值
        
        console.log("--------")

        // let item2 = iterator.next()
        // console.log(item2.value)


        //高级for循环   专门针对迭代器的
        /* 
            通过高级for循环返回的直接就是值
            自己调用next()方法，返回的是Object对象
         */

        for(let item of iterator){
            console.log(item)
        }
       /*  for (const value of iterator) {
            console.log(value);
        }
 */
        // Expected output: "a"
        // Expected output: "b"
        // Expected output: "c"
    </script>
</head>

<body>

</body>

</html>